package com.bd.module.salegood.ui;

import javax.swing.*;
import java.awt.*;
import javax.swing.border.*;

/**
 * JList面板类
 *
 */
public class EDialogListPanel extends JPanel {
	private JPanel listPanel;
	private JPanel labelPanel;
	private JLabel jLabel;
	private JScrollPane jScrollPane;
	protected	JList jList;
	private Border scrollOutBorder;
	private Border scrollInBorder;
	private Border compound;
	
	public EDialogListPanel(ExchangeInfoDialog exInfoDialog){
		listPanel = new JPanel(new BorderLayout());
		labelPanel = new JPanel(new FlowLayout());
		jLabel = new JLabel("交易序号");
	
		
		this.setLayout(new BorderLayout());
		this.setBorder(BorderFactory.createEtchedBorder());
		labelPanel.add(jLabel);
		this.add(labelPanel,BorderLayout.NORTH);
		
		scrollOutBorder = BorderFactory.createEmptyBorder(0,5,5,5);			//进行边界的设定
		scrollInBorder = BorderFactory.createLoweredBevelBorder();
		compound = BorderFactory.createCompoundBorder(scrollOutBorder,scrollInBorder);
		
		jScrollPane = new JScrollPane();									//以下进行JScrollPane的设定
		jScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
		jScrollPane.setBorder(compound);
		MyListDataModel listModel = new MyListDataModel();
		jList = new JList(listModel);
		jList.setLayoutOrientation(JList.VERTICAL);							//以下进行JList的设定
		jList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
		jList.setFixedCellWidth(50);
		jList.addListSelectionListener(exInfoDialog);
		jList.addKeyListener(exInfoDialog);
		listPanel.add(jScrollPane,BorderLayout.CENTER);
		jScrollPane.getViewport().add(jList,null);
		this.add(listPanel,BorderLayout.CENTER);
	}
}
